
import 'package:flutter/material.dart';


class ShareDataWidget extends InheritedWidget {
  ShareDataWidget({
    Key? key,
    this.toDoTaskCount=0,//待审批
    this.carUseTimeOutCout=0,
    this.leaveTimeOutCount=0,
    required Widget child,
  }) : super(key: key, child: child);


  late int toDoTaskCount;
  late int carUseTimeOutCout;
  late int leaveTimeOutCount;


  static ShareDataWidget? of(BuildContext context) {
    return context.dependOnInheritedWidgetOfExactType<ShareDataWidget>();
  }

  //该回调决定当data发生变化时，是否通知子树中依赖data的Widget重新build
  @override
  bool updateShouldNotify(ShareDataWidget old) {
    return (old.toDoTaskCount!=toDoTaskCount || old.carUseTimeOutCout!=carUseTimeOutCout || old.leaveTimeOutCount!=leaveTimeOutCount);
  }
}